import { defineConfig } from 'vite'
import path from 'path'
import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
	plugins: [
		vue(),
	],
	resolve: {
		alias: {
			'@': path.resolve(__dirname, './src'),
		},
	},
	server: {
		proxy: {//代理
			'/api': {
				target: 'http://localhost:9090', // 替换为实际后端API地址
				changeOrigin: true,
				//重写路径  需要设置重写的话，要在后面的调用接口前加上/api 来代替target
				pathRewrite: {
					'^/api': ''
				}
			}
		}
	},
})